﻿Imports System.Data
Imports VSModel
Imports Cls_Common

Partial Class FrontEnd_Control_hitCounter
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Bind2Grid()
        End If
    End Sub
    Protected Sub Bind2Grid()
        'Select Counter
        Using Data As New VSEntities
            Dim p = (From q In Data.Select_HitCounter Select q).ToList
            With rptHitCounter
                .DataSource = p
                .DataBind()
            End With
        End Using
    End Sub

    Protected Sub rptHitCounter_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptHitCounter.ItemDataBound
        Dim row As VSModel.Select_HitCounter_Result = CType(e.Item.DataItem, VSModel.Select_HitCounter_Result)
        Dim lblCounter As Literal
        lblCounter = CType(e.Item.FindControl("lblCounter"), Literal)
        lblCounter.Text = row.Title.ToString & "<span>" & row.Total.ToString & "</span>"
    End Sub
End Class
